﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masterpage/KhachSan.Master" AutoEventWireup="true" CodeBehind="Phong.aspx.cs" Inherits="HotelManagement.ModKhachSan.Phong" %>
<%@ Register src="../Control/CMS/UCToolbar.ascx" tagname="UCToolbar" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
      <asp:ScriptManager runat="server" ID="script1"></asp:ScriptManager>
    <div class="content">
    <div class="DinhDangToolBar">
        <uc1:UCToolbar ID="ToolBar" runat="server" />
    </div>
    <div id="autoDisplayDiv1" class="div_format_conten" >
    <div align = "center" class="clsSearch" style="display: none;">
        <asp:Label ID="lblTrangThai" runat="server" ForeColor="Red" Font-Size="X-Small"></asp:Label>    
    </div>
    <div id="divHienThi" runat="server" class="subcontent">    
         <asp:GridView id="gviMain" Width="100%" runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowPaging  ="true"
                        CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" PageSize="15"
                    OnRowDataBound="gviMain_RowDataBound" OnSorting="gviMain_Sorting" OnPageIndexChanging="gviMain_PageIndexChanging" >		       
		            <Columns>
                            <asp:TemplateField>
                                <ItemStyle Width="20px"  />
                                <HeaderTemplate>
                                    <asp:CheckBox ID="chkall" Runat="server" TextAlign="Left" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkid" Runat="server" TextAlign="Left" />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left"  />
                            </asp:TemplateField>                           
                            <asp:TemplateField HeaderText="STT">
                                <ItemStyle Width="20px" />
                                <HeaderStyle  Width="20px"/>
                                <ItemTemplate>
                                    <%# Container.DataItemIndex + 1 %>
                                </ItemTemplate>
                            </asp:TemplateField>                        
                             <asp:TemplateField Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="lblID" runat="server" Text='<%#Bind("IDPhong") %>'></asp:Label>
                                </ItemTemplate>                            
                            </asp:TemplateField>
                            <asp:BoundField DataField="MaPhong" HeaderText="Mã phòng" 
                                SortExpression="MaPhong" >                            
                                <ItemStyle HorizontalAlign="Left" Width = "120px" />
                            </asp:BoundField>                        
                            <asp:BoundField DataField="TenPhong" HeaderText="Tên phòng" 
                                SortExpression="TenPhong">
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:BoundField>
                            
                            <asp:BoundField DataField="TenTL" HeaderText="T&#7847;ng l&#7847;u" 
                                SortExpression="TenTL">
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:BoundField>
                            <asp:BoundField DataField="TenBD" HeaderText="Building" 
                                SortExpression="TenBD">
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:BoundField>
                            
                            <asp:BoundField DataField="Address" HeaderText="Address" 
                                SortExpression="address">
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:BoundField>
                             <asp:BoundField DataField="Dienthoai" HeaderText="&#272;i&#7879;n tho&#7841;i" 
                                SortExpression="DienThoai">
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:BoundField>
                            <asp:BoundField DataField="SoCua" HeaderText="S&#7889; c&#7917;a" 
                                SortExpression="SoCua">
                                <ItemStyle HorizontalAlign="Right"/>
                            </asp:BoundField>
                            
                             <asp:BoundField DataField="SoNguoiToiDa" HeaderText="S&#7889; ng&#432;&#7901;i t&#7889;i &#273;a" 
                                SortExpression="SoNguoiToiDa">
                                <ItemStyle HorizontalAlign="Right"/>
                            </asp:BoundField>
                            
                        </Columns>
             </asp:GridView>  
    </div>
    <div align="left" id="divCapNhat" runat="server" visible="false" class="subcontent">
        <asp:UpdatePanel runat="server" ID="upnlCheckMa" UpdateMode="Conditional">
            <ContentTemplate>
                <table style="width:90%" class="text_normal">
                    <tr>
                        <td style="width:20%;" align="left"><span>Mã phòng:</span></td>
                        <td> 
                            <asp:TextBox CssClass="text_normal" ID="txtMaPhong" runat="server" MaxLength="3" TabIndex="1" 
                                Width="200px" AutoCompleteType="Disabled" AutoPostBack="True"  onkeypress="return onkeypressnumber(event);" 
                                ontextchanged="txtMaPhong_TextChanged"></asp:TextBox>
                        </td>            
                        <td align="left" style="width:100%;">
                            <div id="divMsg" runat="server"></div>
                        </td>
                    </tr>
                    <tr>
                        <td style="width:20%;" align="left"><span>Tên phòng:</span></td>
                        <td colspan="2"> 
                            <asp:TextBox CssClass="text_normal" ID="txtTenPhong" runat="server"  TabIndex="2" Width="200px"></asp:TextBox>
                        </td>            
                    </tr>
                    
                     <tr>
                        <td style="width:20%;" align="left"><span>Lo&#7841;i phòng:</span></td>
                        <td colspan="2"> 
                            <asp:DropDownList AutoPostBack="true" ID="ddlLoaiPhong" runat="server"  TabIndex="3" Width="200px"
                                >
                            </asp:DropDownList>
                        </td>            
                    </tr>
                    
                    <tr>
                        <td style="width:20%;" align="left"><span>Building:</span></td>
                        <td colspan="2"> 
                            <asp:DropDownList AutoPostBack="true" ID="ddlBuilding" runat="server"  TabIndex="4" Width="200px"
                                onselectedindexchanged="ddlBuilding_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>            
                    </tr>
                      
                     <tr>
                        
                        <td style="width:20%;" align="left"><span>T&#7847;ng l&#7847;u:</span></td>
                        <td colspan="2"> 
                            <asp:DropDownList AutoPostBack="true" ID="ddlTangLau" runat="server"  TabIndex="5" Width="200px"
                                onselectedindexchanged="ddlTangLau_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>            
                    </tr>
                     
                      <tr>
                        <td style="width:20%;" align="left"><span>Address:</span></td>
                        <td colspan="2"> 
                            <asp:TextBox    CssClass="text_normal" ID="txtAddress" runat="server" TabIndex="6"  
                                 Width="200px" Enabled="False"></asp:TextBox>
                        </td>            
                    </tr>
                    
                    <tr>
                        <td style="width:20%;" align="left"><span>S&#7889; c&#7917;a:</span></td>
                        <td colspan="2"> 
                            <asp:TextBox onkeypress="return onkeypressnumber(event);"  CssClass="text_normal" ID="txtSoCua" runat="server"  TabIndex="7" Width="200px"></asp:TextBox>
                        </td>            
                    </tr>
                  <tr>
                        <td style="width:20%;" align="left"><span>S&#7889; ng&#432;&#7901;i t&#7889;i &#273;a:</span></td>
                        <td colspan="2"> 
                            <asp:TextBox onkeypress="return onkeypressnumber(event);"  CssClass="text_normal" ID="txtSoNguoiToiDa" runat="server"  TabIndex="8" Width="200px"></asp:TextBox>
                        </td>            
                    </tr>
                    
                     <tr>
                        <td style="width:20%;" align="left"><span>&#272;i&#7879;n tho&#7841;i:</span></td>
                        <td colspan="2"> 
                            <asp:TextBox  CssClass="text_normal" ID="txtDienThoai"  runat="server"  TabIndex="9" Width="200px"></asp:TextBox>
                        </td>            
                    </tr>
                    
                     <tr>
                        <td style="width:20%;" align="left"><span>Mô t&#7843;:</span></td>
                        <td colspan="2"> 
                            <asp:TextBox  CssClass="text_normal" ID="txtMoTa" TextMode="MultiLine" runat="server"  TabIndex="10" Width="200px"></asp:TextBox>
                        </td>            
                    </tr>
                    
                    
                 </table>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="txtMaPhong" EventName="TextChanged" />
                <asp:AsyncPostBackTrigger ControlID="ddlBuilding" EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="ddlTangLau" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    <div id="popupfilter" style="display:none;">
	    <div class="modalPopup-filter" style="position:absolute;z-index:1;left:100px; top:0;">
	         <div class="clsTable-filter">
	            <div class="clsheader-filter">
	                <div class="clsheader-filter-left"><span>&#272;IÊ&#768;U KIÊ&#803;N TI&#768;M KIÊ&#769;M</span></div>
	                <div class="clsheader-filter-right">
	                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/App_Themes/Theme/delete.gif" Width="20" Height="15" OnClientClick="document.getElementById('popupfilter').style.display= 'none'; return false;" />
	                </div>
	            </div>    
	            <div class="clscontent-filter">
	                
	                <div class="clscontent-filter-row">
	                    <div class="clscontent-filter-left"><span style="font-size:12px; font-weight:bold;">Tên phòng :</span></div>
	                    <div class="clscontent-filter-right">
                            <asp:TextBox runat="server" ID="txtTenPhong_Search" TabIndex="11" Width="200px" MaxLength="100" CssClass="text_normal"></asp:TextBox>
                        </div>
	                </div>
	                <div class="clscontent-filter-row">
	                    <div class="clscontent-filter-left"><span style="font-size:12px; font-weight:bold;">S&#7889; c&#7917;a :</span></div>
	                    <div class="clscontent-filter-right">
                            <asp:TextBox runat="server" onkeypress="return onkeypressnumber(event);" ID="txtSoCua_Search" TabIndex="12" Width="200px" MaxLength="3" CssClass="text_normal"></asp:TextBox>
                        </div>
	                </div>
	                
	                <div class="clscontent-filter-row">
	                    <div class="clscontent-filter-left"><span style="font-size:12px; font-weight:bold;">Address :</span></div>
	                    <div class="clscontent-filter-right">
                            <asp:TextBox runat="server" ID="txtAddress_Search" TabIndex="13" Width="200px"  CssClass="text_normal"></asp:TextBox>
                        </div>
	                </div>
	            </div>
	            <div style="clear:both;"></div>
	            <div class="clschucnang-filter">
	                <asp:Button runat="server"  TabIndex="14" ID="btnTimKiem" CssClass="btnTaoHoSo_70" Text="Th&#432;&#803;c hiê&#803;n" OnClick="btnTimKiem_Click" />
	                <asp:Button runat="server" TabIndex="15" ID="btnDong" CssClass="btnTaoHoSo_70" Text="&#272;óng"  OnClientClick="document.getElementById('popupfilter').style.display= 'none'; return false;" />
	            </div>
	        </div>   
	    </div>
	</div>
</div>   
</div>

        <!--Popup Print-->
<input id="btnShowPopupPrint" type="button" value="show" style="display: none;" runat="server" />
<%--<ajaxtoolkit:modalpopupextender runat="server"  ID="mdPrint" 
          TargetControlID="btnShowPopupPrint" BehaviorID="mdClientPrint"
    PopupControlID="pnlPrint" BackgroundCssClass="modalBackground" 
          DropShadow="false" CancelControlID="btnPrintCancel"/>--%>
<%-- <asp:Panel ID="pnlPrint" runat="server" CssClass="modalPopup" style="display: none;">    
    <div class="clsTitlePopup">
        <div class="clsTitlePopup-left">Cho&#803;n kiê&#777;u xuâ&#769;t file</div>
        <div class="clsTitlePopup-right"><asp:ImageButton ID="btnPrintCancel" runat="server" ImageUrl="../Control/Images/close.png"  OnClientClick="ShowPrint('mdClientPrint',false); return false;" /></div>
    </div>   
    <div class="clsContentPopup">              
        <div class="format_file" >                
             <asp:RadioButtonList ID="radList" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="clsrdoPrint" >
                <asp:ListItem Value="DOC" Selected="True" class="word">Word</asp:ListItem>
                <asp:ListItem Value="XLS" class="excel">Excel</asp:ListItem>
                <asp:ListItem Value="PDF" class="pdf">PDF</asp:ListItem>
             </asp:RadioButtonList>
             <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" />
        </div>            
        <div class="swap_button" >	  	                  
            <asp:Button ID="btnPrint" runat="server" Text="Print" CssClass="button_print_popup" OnClick="btnPrint_Click" />&nbsp;
            <asp:Button ID="btnPrintClose" runat="server" Text="Close" CssClass="button_close_popup" OnClientClick="ShowPrint('mdClientPrint',false); return false;" />                
        </div>
    </div>
</asp:Panel>--%>


<script type="text/javascript" language="javascript">

    function CheckInput() {
        if (document.getElementById("<%= txtMaPhong.ClientID %>").value == "") {
            alert("Mã phòng ch&#432;a &#273;&#432;&#7907;c nh&#7853;p!");
            document.getElementById("<%= txtMaPhong.ClientID %>").focus();
            return false;
        }
        if (document.getElementById("<%= txtTenPhong.ClientID %>").value == "") {
            alert("Tên phòng ch&#432;a &#273;&#432;&#7907;c nh&#7853;p!");
            document.getElementById("<%= txtTenPhong.ClientID %>").focus();
            return false;
        }
        return true;
    }
    function SelectAllItemByCheckBox(id) {
        var cell;
        var grid = document.getElementById("<%= gviMain.ClientID %>");
        if (grid.rows.length > 0) {
            //loop starts from 1. rows[0] points to the header.
            for (i = 1; i < grid.rows.length; i++) {
                //get the reference of first column
                cell = grid.rows[i].cells[0];
                //loop according to the number of childNodes in the cell
                for (j = 0; j < cell.childNodes.length; j++) {
                    //if childNode type is CheckBox                 
                    if (cell.childNodes[j].type == "checkbox") {
                        //assign the status of the Select All checkbox to the cell checkbox within the grid
                        cell.childNodes[j].checked = document.getElementById(id).checked;
                    }
                }
            }
        }
    }

    function CheckSelectRecord() {
        re = new RegExp('gviMain.*chkid');
        for (i = 0; i < document.forms[0].elements.length; i++) {
            elm = document.forms[0].elements[i]
            if (elm.type == 'checkbox') {
                if (re.test(elm.name)) {
                    if (elm.checked) {
                        return true;
                    }
                }
            }
        }
        alert("Hãy ch&#7885;n do&#768;ng d&#432;&#771; liê&#803;u !");
        return false;
    }

    function CheckSelectRecordAndDelete() {


        re = new RegExp('gviMain.*chkid');
        for (i = 0; i < document.forms[0].elements.length; i++) {
            elm = document.forms[0].elements[i]
            if (elm.type == 'checkbox') {
                if (re.test(elm.name)) {
                    if (elm.checked) {
                        if (confirm("B&#7841;n có ch&#7855;c mu&#7889;n xóa không ?") == true)
                            return true;
                        return false;
                    }
                }
            }
        }
        alert("Hãy ch&#7885;n do&#768;ng d&#432;&#771; liê&#803;u !");
        return false;
    }

    function Reset() {
        document.getElementById("<%=txtMaPhong.ClientID %>").value = "";
        document.getElementById("<%=txtTenPhong.ClientID %>").value = "";
        document.getElementById("<%=txtSoCua.ClientID %>").value = "";
        return false;
    }
    function addscriptfilter() {
        document.getElementById('popupfilter').style.display = 'block';
        return false;
    }
</script>

</asp:Content>
